|
|
|
|
|
|
|
used to change the properties of the Data control and enhance its capabilities. In fact, setting up and using the Data control requires only three easy steps: |
|
|
|
|
|
|
|
|
1. Place the Data control on the form. |
|
|
|
|
|
|
|
|
2. Build the database connection string for the database you want to access. |
|
|
|
|
|
|
|
|
3. Set the RecordSource property to the SQL query you want to access in the database. |
|
|
|
|
|
|
|
|
Using the ActiveX Data Control |
|
|
|
|
|
|
|
|
Because this is probably the first time you have heard about the ActiveX Data control, lets see how to use it to access the Biblio.MDB database that is included with Visual Basic. Start a new project and add the ADODC to the Toolbox using the Components dialog. Now, add the controls in Table 10.1 to the form as shown in Figure 10.1. |
|
|
|
|
| TABLE 10.1. ACTIVEX DATA CONTROL DEMO FORM SETUP. | | Object | Property | Value | | ADODC | Name | adcBooks | | Textbox | Name | txtTitle | | Datasource | adcBooks | | DataField | Title | | Command Button | Name | cmdQuit | | Caption | Quit | | Command Button | Name | cmdNext | | Caption | Next | | Command Button | Name | cmdPrev | | Caption | Previous |
|
|
|
|
|
|
Figure 10.1.
The ActiveX Data Control
Demo showing the controls to
add to the Form. |
|
|
|
|
|